package com.legal_documents_backend.controller;

import com.legal_documents_backend.dto.CaseFilterRequest;
import com.legal_documents_backend.pojo.Result;
import com.legal_documents_backend.service.CaseNeo4jService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/case/relations")
@Tag(name="CaseNeo4jController",description = "法律文书知识图谱模块")
public class CaseNeo4jController {
    @Autowired
    private CaseNeo4jService caseService;

    @GetMapping("/case/{caseId}")
    @Operation(summary = "根据案件ID获取与该案件有关的所有节点")
    public Result getCaseRelations(Integer caseId) {
        return Result.success("获取案件关系成功",caseService.getCaseRelations(caseId));
    }

    @PostMapping("/filter")
    @Operation(summary = "根据条件筛选案件，不需要的字段可以不传或传null")
    public Result getCaseFilteredCases(@RequestBody CaseFilterRequest filters){
        return Result.success("获取成功",caseService.getFilteredCasesWithRelations(filters));
    }
}
